<?php
namespace app\home\controller;
use think\Db;
use think\Controller;
class Sign extends Controller
{
    public function Index()
    {
        return view('home@home/Sign');
    }

    public function DoSign(){
        $data= $_POST;
        if (!$data['email']) {
            $this->error('用户邮箱不存在！', 'home/Sign/Index');
        }
        if (!$data['pwd']) {
            $this->error('密码不存在！', 'home/Sign/Index');
        }

        if (!$data['pwd']) {
            $this->error('用户密码不存在！', 'home/Sign/Index');
        }
        if (!$data['name']) {
            $this->error('姓名不存在！', 'home/Sign/Index');
        }



        $list = Db::table('user')->insert($data);
        if ($list > 0) {
            return $this->success('注册成功..', '/home/Login/Index');
        } else {
            return $this->error('注册失败,请重试...');
        }
    }
}
